![]() |
Kinetis SDK API Reference Manual
1.0.0-beta
Freescale Semiconductor, Inc.
|
The section describes the programming interface of the FlexCAN Peripheral driver. More...
Data Structures | |
| struct | flexcan_bitrate_table_t |
| FlexCAN bit rate and the related timing segments structure. More... | |
| struct | flexcan_data_info_t |
| FlexCAN data info from user. More... | |
Macros | |
| #define | FSL_CAN_INTERRUPT_COUNT (4) |
Enumerations | |
| enum | flexcan_bitrate_t { kFlexCanBitrate_125k = 125000, kFlexCanBitrate_250k = 250000, kFlexCanBitrate_500k = 500000, kFlexCanBitrate_750k = 750000, kFlexCanBitrate_1M = 1000000 } |
| FlexCAN bitrates supported. More... | |
Bit rate | |
| flexcan_status_t | flexcan_set_bitrate (uint8_t instance, flexcan_bitrate_t bitrate) |
| Sets FlexCAN bit rate. More... | |
| flexcan_status_t | flexcan_get_bitrate (uint8_t instance, flexcan_bitrate_t *bitrate) |
| Gets FlexCAN bit rate. More... | |
Global mask | |
| void | flexcan_set_mask_type (uint8_t instance, flexcan_rx_mask_type_t type) |
| Sets the RX masking type. More... | |
| flexcan_status_t | flexcan_set_rx_fifo_global_mask (uint8_t instance, flexcan_mb_id_type_t id_type, uint32_t mask) |
| Sets the FlexCAN RX FIFO global standard or extended mask. More... | |
| flexcan_status_t | flexcan_set_rx_mb_global_mask (uint8_t instance, flexcan_mb_id_type_t id_type, uint32_t mask) |
| Sets the FlexCAN RX MB global standard or extended mask. More... | |
| flexcan_status_t | flexcan_set_rx_individual_mask (uint8_t instance, const flexcan_user_config_t *data, flexcan_mb_id_type_t id_type, uint32_t mb_idx, uint32_t mask) |
| Sets the FlexCAN RX individual standard or extended mask. More... | |
Init and Shutdown | |
| flexcan_status_t | flexcan_init (uint8_t instance, const flexcan_user_config_t *data, bool enable_err_interrupts) |
| Initializes the FlexCAN peripheral. More... | |
| uint32_t | flexcan_shutdown (uint8_t instance) |
| Shut down a FlexCAN instance. More... | |
Send configuration | |
| flexcan_status_t | flexcan_tx_mb_config (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_data_info_t *tx_info, uint32_t msg_id) |
| FlexCAN transmit message buffer field configuration. More... | |
| flexcan_status_t | flexcan_send (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_data_info_t *tx_info, uint32_t msg_id, uint32_t num_bytes, uint8_t *mb_data) |
| Sends FlexCAN messages. More... | |
Receive configuration | |
| flexcan_status_t | flexcan_rx_mb_config (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_data_info_t *rx_info, uint32_t msg_id) |
| FlexCAN receive message buffer field configuration. More... | |
| flexcan_status_t | flexcan_rx_fifo_config (uint8_t instance, const flexcan_user_config_t *data, flexcan_rx_fifo_id_element_format_t id_format, flexcan_id_table_t *id_filter_table) |
| FlexCAN RX FIFO field configuration. More... | |
| flexcan_status_t | flexcan_start_receive (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, uint32_t receiveDataCount, bool *is_rx_mb_data, bool *is_rx_fifo_data, flexcan_mb_t *rx_mb, flexcan_mb_t *rx_fifo) |
| FlexCAN is waiting to receive data. More... | |
| flexcan_status_t | flexcan_receive (uint8_t instance, const flexcan_user_config_t *data, uint32_t mb_idx, flexcan_data_info_t *rx_info, uint32_t msg_id, flexcan_rx_fifo_id_element_format_t id_format, flexcan_id_table_t *id_filter_table, uint32_t receiveDataCount, flexcan_mb_t *rx_mb, flexcan_mb_t *rx_fifo) |
| FlexCAN is preparing to receive data. More... | |
| struct flexcan_bitrate_table_t |
Data Fields | |
| flexcan_bitrate_t | bit_rate |
| bit rate | |
| uint32_t | propseg |
| Propagation segment. | |
| uint32_t | pseg1 |
| Phase segment 1. | |
| uint32_t | pseg2 |
| Phase segment 2. | |
| uint32_t | pre_divider |
| Clock pre divider. | |
| uint32_t | rjw |
| Re-sync jump width. | |
| struct flexcan_data_info_t |
Data Fields | |
| flexcan_mb_id_type_t | msg_id_type |
| Type of message ID (standard or extended) | |
| uint32_t | data_length |
| Length of Data in Bytes. | |
| enum flexcan_bitrate_t |
| flexcan_status_t flexcan_set_bitrate | ( | uint8_t | instance, |
| flexcan_bitrate_t | bitrate | ||
| ) |
| instance | A FlexCAN instance number |
| bit | rate Selects a FlexCAN bit rate in the bit_rate_table. |
| flexcan_status_t flexcan_get_bitrate | ( | uint8_t | instance, |
| flexcan_bitrate_t * | bitrate | ||
| ) |
| instance | A FlexCAN instance number |
| bit | rate A pointer to a variable for returning the FlexCAN bit rate in the bit_rate_table. |
| void flexcan_set_mask_type | ( | uint8_t | instance, |
| flexcan_rx_mask_type_t | type | ||
| ) |
| instance | A FlexCAN instance number |
| type | The FlexCAN RX mask type |
| flexcan_status_t flexcan_set_rx_fifo_global_mask | ( | uint8_t | instance, |
| flexcan_mb_id_type_t | id_type, | ||
| uint32_t | mask | ||
| ) |
| instance | A FlexCAN instance number |
| id_type | Standard ID or extended ID |
| mask | Mask value |
| flexcan_status_t flexcan_set_rx_mb_global_mask | ( | uint8_t | instance, |
| flexcan_mb_id_type_t | id_type, | ||
| uint32_t | mask | ||
| ) |
| instance | A FlexCAN instance number |
| id_type | Standard ID or extended ID |
| mask | Mask value |
| flexcan_status_t flexcan_set_rx_individual_mask | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| flexcan_mb_id_type_t | id_type, | ||
| uint32_t | mb_idx, | ||
| uint32_t | mask | ||
| ) |
| instance | A FlexCAN instance number |
| id_type | A standard ID or an extended ID |
| mb_idx | Index of the message buffer |
| mask | Mask value |
| flexcan_status_t flexcan_init | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| bool | enable_err_interrupts | ||
| ) |
This function initializes
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| enable_err_interrupts | 1 if enabled, 0 if not |
| uint32_t flexcan_shutdown | ( | uint8_t | instance | ) |
| instance | A FlexCAN instance number |
| flexcan_status_t flexcan_tx_mb_config | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| uint32_t | mb_idx, | ||
| flexcan_data_info_t * | tx_info, | ||
| uint32_t | msg_id | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| mb_idx | Index of the message buffer |
| tx_info | Data info |
| msg_id | ID of the message to transmit |
| flexcan_status_t flexcan_send | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| uint32_t | mb_idx, | ||
| flexcan_data_info_t * | tx_info, | ||
| uint32_t | msg_id, | ||
| uint32_t | num_bytes, | ||
| uint8_t * | mb_data | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| mb_idx | Index of the message buffer |
| tx_info | Data info |
| msg_id | ID of the message to transmit |
| num_bytes | The number of bytes in mb_data |
| mb_data | Bytes of the FlexCAN message |
| flexcan_status_t flexcan_rx_mb_config | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| uint32_t | mb_idx, | ||
| flexcan_data_info_t * | rx_info, | ||
| uint32_t | msg_id | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| mb_idx | Index of the message buffer |
| rx_info | Data info |
| msg_id | ID of the message to transmit |
| flexcan_status_t flexcan_rx_fifo_config | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| flexcan_rx_fifo_id_element_format_t | id_format, | ||
| flexcan_id_table_t * | id_filter_table | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| id_format | The format of the Rx FIFO ID Filter Table Elements |
| id_filter_table | The ID filter table elements which contain RTR bit, IDE bit, and RX message ID |
| flexcan_status_t flexcan_start_receive | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| uint32_t | mb_idx, | ||
| uint32_t | receiveDataCount, | ||
| bool * | is_rx_mb_data, | ||
| bool * | is_rx_fifo_data, | ||
| flexcan_mb_t * | rx_mb, | ||
| flexcan_mb_t * | rx_fifo | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| mb_idx | Index of the message buffer |
| msg_id | ID of the message to transmit |
| receiveDataCount | The number of data to be received |
| rx_mb | The FlexCAN receive message buffer data. |
| rx_fifo | The FlexCAN receive FIFO data. |
| flexcan_status_t flexcan_receive | ( | uint8_t | instance, |
| const flexcan_user_config_t * | data, | ||
| uint32_t | mb_idx, | ||
| flexcan_data_info_t * | rx_info, | ||
| uint32_t | msg_id, | ||
| flexcan_rx_fifo_id_element_format_t | id_format, | ||
| flexcan_id_table_t * | id_filter_table, | ||
| uint32_t | receiveDataCount, | ||
| flexcan_mb_t * | rx_mb, | ||
| flexcan_mb_t * | rx_fifo | ||
| ) |
| instance | A FlexCAN instance number |
| data | The FlexCAN platform data |
| mb_idx | Index of the message buffer |
| cs | CODE/status values (RX) |
| msg_id | ID of the message to transmit |
| id_format | The format of the Rx FIFO ID Filter Table Elements |
| id_filter_table | The ID filter table elements which contain RTR bit, IDE bit, and RX message ID |
| receiveDataCount | The number of data to be received |
| rx_mb | The FlexCAN receive message buffer data |
| rx_fifo | The FlexCAN receive FIFO data |